package com.jy.adscm.zltx.controller;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.jy.adscm.exception.AdscmSystemException;
import com.jy.adscm.support.SimpleCoreResponse;
import com.jy.adscm.zltx.bean.JyDrawingRelation;
import com.jy.adscm.zltx.bean.JyDrawingUser;
import com.jy.adscm.zltx.service.JyDrawingUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 用户与图纸关系 前端控制器
 * </p>
 *
 * @author zyl
 * @since 2019-07-02
 */
@RestController
@RequestMapping("/adscm/zltx/jyDrawingUser")
public class JyDrawingUserController {

    @Autowired
    JyDrawingUserService jyDrawingUserService;
    @RequestMapping("/insert")
    public SimpleCoreResponse insert(List<JyDrawingUser> jyDrawingUsers ,HttpServletRequest request) throws AdscmSystemException, IOException {
        boolean result=  jyDrawingUserService.insertJyDrawingUser(jyDrawingUsers);
        return new SimpleCoreResponse("200","新增成功" ,result);
    }
    @RequestMapping("/select/{id}")
    public SimpleCoreResponse select(@PathVariable Integer id, HttpServletRequest request) throws AdscmSystemException {
        Wrapper<JyDrawingUser> wrapper =new EntityWrapper<>();
        wrapper.eq("user_id",id);
        return new SimpleCoreResponse("200","新增成功" ,jyDrawingUserService.selectList(wrapper));
    }

}

